import {
	http
} from "./request";

// 用户相关接口
export const userApi = {
	// 微信登录
	login: (data) => http.post('/api/users/login', data, {
		hideLoading: true
	}),

	// 获取用户信息
	getUserInfo: () => http.get('/api/users/info'),

	// 更新用户信息
	updateUserInfo: (data) => http.put('/api/users/info', data, {
		hideLoading: true
	}),

	// 退出登录
	logout: () => http.post('/api/users/logout'),
	getMySonUsers: (data) => http.get('/api/users/sonsUsers', data)
}

// AI对话相关接口
export const chatApi = {
	// 发送消息
	// sendMessage: (data) => http.post('/api/chat/send', data),
	// /api/message/getCacheMessage
	getCacheMessage: (query) => http.get('/api/message/getCacheMessage', query, {
		hideLoading: true
	}),
	// 获取全部历史消息
	getHistory: (params) => http.get('/api/message/getAllHistoryMessage', params, {
		hideLoading: true
	}),

	// 获取智能体信息
	getAgentInfo: (params) => http.get('/api/coze/botInfo', params, {
		hideLoading: true
	}),

	// 获取最新会话，没有则新建
	getConversation: (data) => http.post('/api/coze/myLastConversation', data, {
		hideLoading: true
	}),

	// 创建新会话 /api/coze/createConversation
	createConversation: (data) => http.post('/api/coze/createConversation', data, {
		hideLoading: true
	}),

	//发送消息按钮——创建消息并对话
	sendMyMessageNotStream: (data) => http.post('/api/chat/createAndChat', data, {
		hideLoading: true
	}),

	getMessageDetail: (data) => http.get('/api/chat/detail', data, {
		hideLoading: true
	}), //只能取到状态
	///api/chat/message 
	getMessage: (data) => http.get('/api/chat/message', data, {
		hideLoading: true
	}), //能获取到具体消息

	// 创建消息
	// createMessags:()=>http.post('/api/message/createMessage'),

	// 删除消息
	delMessages: (params) => http.get('/api/message/deleteMessage', params),

	// 清空会话
	delConversation: (params) => http.get('/api/conversation/clearConversation', params),

	// /api/chat/stopChat
	stopChat: (p) => http.get('/api/chat/stopChat', p),

	///api/chat/getUserAskLog 获取用户询问历史
	getUserAskLog: (p) => http.get('/api/chat/getUserAskLog', p)

}

export const aiApi = {
	// 设置用户个人访问令牌
	sendAccessToken: (data) => http.post('/api/users/setCozeAccessToken', data),
	
	// /api/users/setCozeOAuth
	setCozeOAuth:(data) => http.post('/api/users/setCozeOAuth',data),

	// 获取Coze个人空间列表接口
	getCozePersonalList: () => http.get('/api/coze/workspaces'),

	// 获取Coze 合并列表
	getMergeList: () => http.get('/api/coze/allSpaceAndBot'),

	// 智能体发布
	publishAi: (data) => http.post('/api/agent/publicAgent', data),

	// 获取我的智能体列表 /api/agent/myAgentList get
	getAiList: () => http.get('/api/agent/myAgentList'),

	// /api/agent/publicAgentList get  获取所有公开智能体列表
	getAllPulbicAgent: () => http.get('/api/agent/publicAgentList', null, {
		hideLoading: true
	}),

	// /api/agent/setAgentIsPublic 设置智能体是否公开
	setAgentIsPublic: (data) => http.post('/api/agent/setAgentIsPublic', data),

	// /api/agent/syncAgentInfo get  同步智能体信息
	syncAgentInfo: (params) => http.get('/api/agent/syncAgentInfo', params),

	// /api/agent/getAgentInfoByAgentId get 根据智能体ID获取智能体信息
	getAgentInfoByAgentId: (params) => http.get('/api/agent/getAgentInfoByAgentId', params),

	// 支付接口
	payVip: (data) => http.post('/api/vip/pay', data),

	// 生成邀请码 '/api/inviteCode/generate'
	generateInviteCode: () => http.get('/api/inviteCode/generate'),

	// 使用邀请码 '/api/inviteCode/use'
	useInviteCode: (data) => http.post('/api/inviteCode/use', data),

	//获取邀请码列表
	getInviteCodeList: () => http.get('/api/inviteCode/list'),

	// 支付校验 /api/vip/payCheck
	payCheck: (data) => http.post('/api/vip/payCheck', data),
}